/*
 * Copyright (c) 2016. For Intelligent Group.
 */

package com.intelligent.ispc.client.utils;

import java.awt.*;

/**
 * Created by Peter on 2016/7/7.
 */
public class GBC extends GridBagConstraints {
    /**
     * Initial the left corner point
     *
     * @param gridx gridx
     * @param gridy gridy
     */
    public GBC(int gridx, int gridy) {
        this.gridx = gridx;
        this.gridy = gridy;
    }

    /**
     * Initial the left corner point, and grid with / height.
     *
     * @param gridx      gridx
     * @param gridy      gridy
     * @param gridwidth  gridwidth
     * @param gridheight gridheight
     */
    public GBC(int gridx, int gridy, int gridwidth, int gridheight) {
        this.gridx = gridx;
        this.gridy = gridy;
        this.gridwidth = gridwidth;
        this.gridheight = gridheight;
    }

    /**
     * Alignment.
     *
     * @param anchor anchor
     * @return GBC self
     */
    public GBC setAnchor(int anchor) {
        this.anchor = anchor;
        return this;
    }

    /**
     * The fill and direction.
     *
     * @param fill fill
     * @return GBC self
     */
    public GBC setFill(int fill) {
        this.fill = fill;
        return this;
    }

    /**
     * The weight x/y setting
     *
     * @param weightx weightx
     * @param weighty weighty
     * @return GBC self
     */
    public GBC setWeight(double weightx, double weighty) {
        this.weightx = weightx;
        this.weighty = weighty;
        return this;
    }

    /**
     * The inset distance.
     *
     * @param distance distance
     * @return GBC self
     */
    public GBC setInsets(int distance) {
        this.insets = new Insets(distance, distance, distance, distance);
        return this;
    }

    /**
     * The inset distance.
     *
     * @param top    top
     * @param left   left
     * @param bottom bottom
     * @param right  right
     * @return GBC self
     */
    public GBC setInsets(int top, int left, int bottom, int right) {
        this.insets = new Insets(top, left, bottom, right);
        return this;
    }

    /**
     * The ipad distance.
     *
     * @param ipadx ipadx
     * @param ipady ipady
     * @return GBC self
     */
    public GBC setIpad(int ipadx, int ipady) {
        this.ipadx = ipadx;
        this.ipady = ipady;
        return this;
    }
}
